import axios from 'axios'
import config from '@/config'

export function orderRepeat(data) {
    return axios({
        method: 'post',
        url: config.serverURI + config.api.repeat_order,
        data
    })
}

export function icalRepeat() {
    return axios({
        method: 'post',
        url: config.serverURI + config.api.repeat_ical,
    })
}

export function orderExp(data) {
    return axios({
        method: 'post',
        url: config.serverURI + config.api.order_exp,
        data
    })
}

export function list(note, opt = {}, page = 1) {
    return axios({
        method: 'post',
        data: {note_name: note, opt, page},
        url: config.serverURI + config.api.notification
    })
}

export function ignore(note, id, page, opt, operation, type='no_date_return') {
    return axios({
        method: 'post',
        data: {note_name: note, item_id: id, operation, page, opt, type},
        url: config.serverURI + config.api.seen_notification,
    })
}

export function queryReviewOrder() {
    const url = config.serverURI + config.api.query_review_order
    return axios({
        method: 'post',
        url: url
    })
}

export function getQuestionableOrder(start, end) {
    const url = config.serverURI + config.api.order_exp
    return axios({
        method: 'post',
        url: url,
        data: {
            start,
            end
        }
    })
}

export function createChecklistFromTemplate(param) {
    const url = config.serverURI + config.api.createChecklistFromTemplate
    return axios({
        method: 'post',
        url: url,
        data: param
    })
}